-- we don't know how to generate root <with-no-name> (class Root) :(
-- 创建库
create database if not exists bJianOJ;

-- 切换库
use bJianOJ;

create table user
(
    id           bigint auto_increment comment 'id'
        primary key,
    userAccount  varchar(256)                           not null comment '账号',
    userPassword varchar(512)                           not null comment '密码',
    unionId      varchar(256)                           null comment '微信开放平台id',
    mpOpenId     varchar(256)                           null comment '公众号openId',
    userName     varchar(256)                           null comment '用户昵称',
    userAvatar   varchar(1024)                          null comment '用户头像',
    userProfile  varchar(512)                           null comment '用户简介',
    userRole     varchar(256) default 'user'            not null comment '用户角色：user/admin/ban',
    createTime   datetime     default CURRENT_TIMESTAMP not null comment '创建时间',
    updateTime   datetime     default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
    isDelete     tinyint      default 0                 not null comment '是否删除'
)
    comment '用户' collate = utf8mb4_unicode_ci;

create index idx_unionId
    on user (unionId);

INSERT INTO user (id, userAccount, userPassword, unionId, mpOpenId, userName, userAvatar, userProfile, userRole, createTime, updateTime, isDelete) VALUES (1642821974700257281, 'test', 'b0dd3697a192885d7c055db46155b26a', null, null, 'bJian', null, '管理员，主要的账户', 'user', '2023-04-03 17:30:55', '2023-04-11 15:29:07', 0);
INSERT INTO user (id, userAccount, userPassword, unionId, mpOpenId, userName, userAvatar, userProfile, userRole, createTime, updateTime, isDelete) VALUES (1644168415926468609, 'admin', 'b0dd3697a192885d7c055db46155b26a', null, null, 'test', null, '123，123，测试简介', 'user', '2023-04-07 10:41:12', '2023-04-11 15:29:07', 0);
INSERT INTO user (id, userAccount, userPassword, unionId, mpOpenId, userName, userAvatar, userProfile, userRole, createTime, updateTime, isDelete) VALUES (1704859189244317697, 'newUser', 'ad97089b8c49f173d1201542a6d57317', null, null, '新用户98381', null, null, 'user', '2023-09-21 22:04:40', '2023-09-21 22:04:40', 0);
INSERT INTO user (id, userAccount, userPassword, unionId, mpOpenId, userName, userAvatar, userProfile, userRole, createTime, updateTime, isDelete) VALUES (1705885484438695938, 'test1', 'ad97089b8c49f173d1201542a6d57317', null, null, '新用户57191', null, null, 'user', '2023-09-24 18:02:47', '2023-09-24 18:02:47', 0);
INSERT INTO user (id, userAccount, userPassword, unionId, mpOpenId, userName, userAvatar, userProfile, userRole, createTime, updateTime, isDelete) VALUES (1711642208604958721, 'test1111', 'ad97089b8c49f173d1201542a6d57317', null, null, '新用户46809', null, null, 'user', '2023-10-10 15:17:57', '2023-10-10 15:17:57', 0);
INSERT INTO user (id, userAccount, userPassword, unionId, mpOpenId, userName, userAvatar, userProfile, userRole, createTime, updateTime, isDelete) VALUES (1730119500083666946, '123admin', 'ad97089b8c49f173d1201542a6d57317', null, null, '新用户11933', null, null, 'user', '2023-11-30 15:00:07', '2023-11-30 15:00:07', 0);



create table post
(
    id         bigint auto_increment comment 'id'
        primary key,
    title      varchar(512)                       null comment '标题',
    content    text                               null comment '内容',
    tags       varchar(1024)                      null comment '标签列表（json 数组）',
    thumbNum   int      default 0                 not null comment '点赞数',
    favourNum  int      default 0                 not null comment '收藏数',
    userId     bigint                             not null comment '创建用户 id',
    createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
    updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
    isDelete   tinyint  default 0                 not null comment '是否删除'
)
    comment '帖子' collate = utf8mb4_unicode_ci;

create index idx_userId
    on post (userId);

create table post_favour
(
    id         bigint auto_increment comment 'id'
        primary key,
    postId     bigint                             not null comment '帖子 id',
    userId     bigint                             not null comment '创建用户 id',
    createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
    updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间'
)
    comment '帖子收藏';

create index idx_postId
    on post_favour (postId);

create index idx_userId
    on post_favour (userId);

create table post_thumb
(
    id         bigint auto_increment comment 'id'
        primary key,
    postId     bigint                             not null comment '帖子 id',
    userId     bigint                             not null comment '创建用户 id',
    createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
    updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间'
)
    comment '帖子点赞';

create index idx_postId
    on post_thumb (postId);

create index idx_userId
    on post_thumb (userId);

create table question
(
    id          bigint auto_increment comment 'id'
        primary key,
    title       varchar(512)                       null comment '标题',
    content     text                               null comment '内容',
    tags        varchar(1024)                      null comment '标签列表（json 数组）',
    answer      text                               null comment '题目答案',
    submitNum   int      default 0                 not null comment '题目提交数',
    acceptedNum int      default 0                 not null comment '题目通过数',
    judgeCase   text                               null comment '判题用例（json 数组）',
    judgeConfig text                               null comment '判题配置（json 对象）',
    thumbNum    int      default 0                 not null comment '点赞数',
    favourNum   int      default 0                 not null comment '收藏数',
    userId      bigint                             not null comment '创建用户 id',
    createTime  datetime default CURRENT_TIMESTAMP not null comment '创建时间',
    updateTime  datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
    isDelete    tinyint  default 0                 not null comment '是否删除'
)
    comment '题目' collate = utf8mb4_unicode_ci;

create index idx_userId
    on question (userId);

create table question_submit
(
    id         bigint auto_increment comment 'id'
        primary key,
    language   varchar(128)                       not null comment '编程语言',
    code       text                               not null comment '用户代码',
    judgeInfo  text                               null comment '判题信息（json 对象）',
    status     int      default 0                 not null comment '判题状态（0 - 待判题、1 - 判题中、2 - 成功、3 - 失败）',
    questionId bigint                             not null comment '题目 id',
    userId     bigint                             not null comment '创建用户 id',
    createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
    updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
    isDelete   tinyint  default 0                 not null comment '是否删除'
)
    comment '题目提交';

create index idx_questionId
    on question_submit (questionId);

create index idx_userId
    on question_submit (userId);


INSERT INTO question (id, title, content, tags, answer, submitNum, acceptedNum, judgeCase, judgeConfig, thumbNum, favourNum, userId, createTime, updateTime, isDelete) VALUES (1, 'qwe', 'qwe', '["qew"]', 'qwe', 0, 0, '{"timeLimit":1000,"memoryLimit":1000,"stackLimit":1000}', null, 0, 0, 1730119500083666946, '2023-12-07 16:29:53', '2023-12-12 16:39:15', 1);
INSERT INTO question (id, title, content, tags, answer, submitNum, acceptedNum, judgeCase, judgeConfig, thumbNum, favourNum, userId, createTime, updateTime, isDelete) VALUES (2, '12', '### a
dsadsa1
', '["111"]', '### aaa
# a
dada
', 0, 0, '{"timeLimit":1000,"memoryLimit":1000,"stackLimit":1000}', null, 0, 0, 1730119500083666946, '2023-12-07 16:36:52', '2023-12-07 16:36:52', 0);
INSERT INTO question (id, title, content, tags, answer, submitNum, acceptedNum, judgeCase, judgeConfig, thumbNum, favourNum, userId, createTime, updateTime, isDelete) VALUES (3, '1', '1111', '["rfff"]', '1111', 0, 0, '{"timeLimit":1000,"memoryLimit":1000,"stackLimit":1000}', null, 0, 0, 1730119500083666946, '2023-12-07 16:37:43', '2023-12-07 16:37:43', 0);
INSERT INTO question (id, title, content, tags, answer, submitNum, acceptedNum, judgeCase, judgeConfig, thumbNum, favourNum, userId, createTime, updateTime, isDelete) VALUES (4, '1', '1111', '["rfff"]', '1111', 0, 0, '{"timeLimit":1000,"memoryLimit":1000,"stackLimit":1000}', null, 0, 0, 1730119500083666946, '2023-12-07 16:39:29', '2023-12-07 16:39:29', 0);
INSERT INTO question (id, title, content, tags, answer, submitNum, acceptedNum, judgeCase, judgeConfig, thumbNum, favourNum, userId, createTime, updateTime, isDelete) VALUES (5, '1', '1111', '["rfff"]', '1111', 0, 0, '[{"input":"1","output":"1"},{"input":"1","output":"1"}]', '{"timeLimit":1000,"memoryLimit":1000,"stackLimit":1000}', 0, 0, 1730119500083666946, '2023-12-07 16:40:03', '2024-02-26 16:21:52', 1);
INSERT INTO question (id, title, content, tags, answer, submitNum, acceptedNum, judgeCase, judgeConfig, thumbNum, favourNum, userId, createTime, updateTime, isDelete) VALUES (6, 'test数据', '1
### 1111
@@
    1
    
    121
    32131
    321', '["123","test","java"]', 'answer
123
###阿
    ', 0, 0, '[{"input":"1","output":"2"},{"input":"3","output":"4"}]', '{"timeLimit":1000,"memoryLimit":1000,"stackLimit":1000}', 0, 0, 1730119500083666946, '2023-12-12 16:38:17', '2023-12-12 16:38:17', 0);
INSERT INTO question (id, title, content, tags, answer, submitNum, acceptedNum, judgeCase, judgeConfig, thumbNum, favourNum, userId, createTime, updateTime, isDelete) VALUES (7, '1', '1', '[]', '1', 0, 0, '[{"input":"1","output":"1"}]', '{"timeLimit":1000,"memoryLimit":1000,"stackLimit":1000}', 0, 0, 1730119500083666946, '2024-02-26 16:22:09', '2024-02-26 16:22:09', 0);
INSERT INTO question (id, title, content, tags, answer, submitNum, acceptedNum, judgeCase, judgeConfig, thumbNum, favourNum, userId, createTime, updateTime, isDelete) VALUES (8, 'A+B Problem', '# A+B Problem

## 题目背景

强烈推荐[新用户必读帖](/discuss/show/241461)。

**不熟悉算法竞赛的选手请看这里：**

算法竞赛中要求的输出格式中，**不能有多余的内容**，**这也包括了“请输入整数 $\\bm a$ 和 $\\bm b$” 这一类的提示用户输入信息的内容**。若包含了这些内容，将会被认为是 `Wrong Answer`，即洛谷上的 `WA`。在对比代码输出和标准输出时，系统将忽略每一行结尾的空格，以及最后一行之后多余的换行符。

若因此类问题出现本机似乎输出了正确的结果，但是实际提交结果为错误的现象，请勿认为是洛谷评测机出了问题，而是你的代码中可能存在多余的输出信息。用户可以参考在题目末尾提供的代码。

此外，**请善用应用中的在线 IDE 功能**，以避免不同平台的评测产生差异。

最后，请不要在对应的题目讨论区中发布自己的题解，请发布到题解区域中，否则将处以删除或禁言的处罚。若发现无法提交题解则表明本题题解数量过多，仍不应发布讨论。若您的做法确实与其他所有题解均不一样，请联系管理员添加题解。

## 题目描述

输入两个整数 $a, b$，输出它们的和（$|a|,|b| \\le {10}^9$）。

注意

1. Pascal 使用 `integer` 会爆掉哦！
2. 有负数哦！
3. C/C++ 的 main 函数必须是 `int` 类型，而且 C 最后要 `return 0`。这不仅对洛谷其他题目有效，而且也是 NOIP/CSP/NOI 比赛的要求！

好吧，同志们，我们就从这一题开始，向着大牛的路进发。

> 任何一个伟大的思想，都有一个微不足道的开始。

## 输入格式

两个以空格分开的整数。

## 输出格式

一个整数。

## 样例 #1

### 样例输入 #1

```
20 30
```

### 样例输出 #1

```
50
```

## 提示

**本题各种语言的程序范例：**

C
```c
#include <stdio.h>

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d\\n", a+b);
    return 0;
}
```
----------------

C++
```cpp
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    cout << a+b << endl;
    return 0;
}
```
----------------

Pascal
```cpp
var a, b: longint;
begin
    readln(a,b);
    writeln(a+b);
end.
```
-----------------

Python2

```cpp
s = raw_input().split()
print int(s[0]) + int(s[1])
```
-----------------

Python3

```cpp
s = input().split()
print(int(s[0]) + int(s[1]))
```
-----------------

Java
```java
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[]) throws Exception {
        Scanner cin=new Scanner(System.in);
        int a = cin.nextInt(), b = cin.nextInt();
        System.out.println(a+b);
    }
}
```
-----------------

JavaScript （Node.js）

```javascript
const fs = require(\'fs\')
const data = fs.readFileSync(\'/dev/stdin\')
const result = data.toString(\'ascii\').trim().split(\' \').map(x => parseInt(x)).reduce((a, b) => a + b, 0)
console.log(result)
process.exit() // 请注意必须在出口点处加入此行
```

-----------------

Ruby

```ruby
a, b = gets.split.map(&:to_i)
print a+b
```

-----------------

PHP

```php
<?php
$input = trim(file_get_contents("php://stdin"));
list($a, $b) = explode(\' \', $input);
echo $a + $b;
```

-----------------

Rust

```rust
use std::io;

fn main(){
    let mut input=String::new();
    io::stdin().read_line(&mut input).unwrap();
    let mut s=input.trim().split(\' \');

    let a:i32=s.next().unwrap()
               .parse().unwrap();
    let b:i32=s.next().unwrap()
               .parse().unwrap();
    println!("{}",a+b);
}
```

-----------------

Go

```go
package main

import "fmt"

func main() {
    var a, b int
    fmt.Scanf("%d%d", &a, &b)
    fmt.Println(a+b)
}
```

-----------------

C# Mono

```cs
using System;

public class APlusB{
    private static void Main(){
        string[] input = Console.ReadLine().Split(\' \');
        Console.WriteLine(int.Parse(input[0]) + int.Parse(input[1]));
    }
}
```

------------------

Visual Basic Mono

```vb
Imports System

Module APlusB
    Sub Main()
        Dim ins As String() = Console.ReadLine().Split(New Char(){" "c})
        Console.WriteLine(Int(ins(0))+Int(ins(1)))
    End Sub
End Module
```

------------------

Kotlin

```kotlin
fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(\' \').map(String::toInt)
    println(a + b)
}
```

------------------

Haskell

```haskell
main = do
    [a, b] <- (map read . words) `fmap` getLine
    print (a+b)
```

------------------

Lua

```lua
a = io.read(\'*n\')
b = io.read(\'*n\')
print(a + b)
```

------------------

OCaml

```ocaml
Scanf.scanf "%i %i\\n" (fun a b -> print_int (a + b))
```

------------------

Julia

```julia
nums = map(x -> parse(Int, x), split(readline(), " "))
println(nums[1] + nums[2])
```

------------------

Scala

```scala
object Main extends App {
    println(scala.io.StdIn.readLine().split(" ").map(_.toInt).sum)
}
```

------------------

Perl

```perl
my $in = <STDIN>;
chomp $in;
$in = [split /[\\s,]+/, $in];
my $c = $in->[0] + $in->[1];
print "$c\\n";
```', '["入门","java"]', '', 0, 0, '[{"input":"1 2","output":"3"}]', '{"timeLimit":1000,"memoryLimit":1000,"stackLimit":1000}', 0, 0, 1730119500083666946, '2024-03-01 13:08:17', '2024-03-01 13:08:17', 0);


INSERT INTO question_submit (id, language, code, judgeInfo, status, questionId, userId, createTime, updateTime, isDelete) VALUES (1, 'java', '', null, 1, 8, 1711642208604958721, '2024-04-10 15:52:43', '2024-04-10 15:52:43', 0);
INSERT INTO question_submit (id, language, code, judgeInfo, status, questionId, userId, createTime, updateTime, isDelete) VALUES (2, 'java', '', null, 1, 8, 1711642208604958721, '2024-04-10 15:54:55', '2024-04-10 15:54:55', 0);
INSERT INTO question_submit (id, language, code, judgeInfo, status, questionId, userId, createTime, updateTime, isDelete) VALUES (3, 'java', '', '{"message":"Wrong Answer","time":-9223372036854775808}', 2, 8, 1711642208604958721, '2024-04-10 16:03:09', '2024-04-10 16:03:09', 0);
INSERT INTO question_submit (id, language, code, judgeInfo, status, questionId, userId, createTime, updateTime, isDelete) VALUES (4, 'java', '', null, 1, 8, 1711642208604958721, '2024-04-10 16:06:23', '2024-04-10 16:06:23', 0);
INSERT INTO question_submit (id, language, code, judgeInfo, status, questionId, userId, createTime, updateTime, isDelete) VALUES (5, 'java', '', null, 1, 8, 1711642208604958721, '2024-04-10 16:06:23', '2024-04-10 16:06:23', 0);
INSERT INTO question_submit (id, language, code, judgeInfo, status, questionId, userId, createTime, updateTime, isDelete) VALUES (6, 'java', 'public class Main {
    public static void main(String[] args) {
        int arg = Integer.parseInt(args[0]);
        int arg1 = Integer.parseInt(args[1]);

        System.out.println(arg1+arg);

    }
}
', '{"message":"Wrong Answer运行结果：3\\n,预期结果：3","time":343}', 2, 8, 1711642208604958721, '2024-04-10 16:14:36', '2024-04-10 16:14:36', 0);
INSERT INTO question_submit (id, language, code, judgeInfo, status, questionId, userId, createTime, updateTime, isDelete) VALUES (7, 'java', 'public class Main {
    public static void main(String[] args) {
        int arg = Integer.parseInt(args[0]);
        int arg1 = Integer.parseInt(args[1]);

        System.out.println(arg1+arg);

    }
}
', '{"message":"Wrong Answer运行结果：3\\n,预期结果：3","time":235}', 2, 8, 1711642208604958721, '2024-04-10 16:28:34', '2024-04-10 16:28:34', 0);
INSERT INTO question_submit (id, language, code, judgeInfo, status, questionId, userId, createTime, updateTime, isDelete) VALUES (8, 'java', 'public class Main {
    public static void main(String[] args) {
        int arg = Integer.parseInt(args[0]);
        int arg1 = Integer.parseInt(args[1]);

        System.out.println(arg1+arg);

    }
}
', null, 1, 8, 1711642208604958721, '2024-04-10 16:54:33', '2024-04-10 16:54:33', 0);
INSERT INTO question_submit (id, language, code, judgeInfo, status, questionId, userId, createTime, updateTime, isDelete) VALUES (9, 'java', 'public class Main {
    public static void main(String[] args) {
        int arg = Integer.parseInt(args[0]);
        int arg1 = Integer.parseInt(args[1]);

        System.out.println(arg1+arg);

    }
}
', null, 1, 8, 1711642208604958721, '2024-04-10 16:57:09', '2024-04-10 16:57:09', 0);
INSERT INTO question_submit (id, language, code, judgeInfo, status, questionId, userId, createTime, updateTime, isDelete) VALUES (10, 'java', 'public class Main {
    public static void main(String[] args) {
        int arg = Integer.parseInt(args[0]);
        int arg1 = Integer.parseInt(args[1]);

        System.out.println(arg1+arg);

    }
}
', null, 1, 8, 1711642208604958721, '2024-04-10 16:58:01', '2024-04-10 16:58:01', 0);
